Field of the Invention
The present invention relates to a coding apparatus, a coding method, and a storage medium, and, more particularly, to a technique adapted to be used to adaptively control a quantization parameter in a picture.
Description of the Related Art
Well-known coding methods used for compression recording of moving images include H.264/MPEG-4 AVC (hereinafter referred to as “H.264”) (see Literature 1: ITU-T H.264 (March 2010) Advanced video coding for generic audiovisual services). Furthermore, there was developed a more high-efficient coding method serving as a successor to H.264, called H.265/High Efficiency Video Coding (hereinafter referred to as “HEVC”) (see Literature 2: ITU-T H.265 (April 2013) High efficiency video coding).
H.264 and HEVC allow coding of pictures with picture types switched on a picture-by-picture basis. The picture types include an intra picture (hereinafter referred to as an “I picture”), in which coding is performed using only information contained in a picture, and an inter picture, in which coding is performed using information contained in another picture (hereinafter referred to as a “reference picture”) in addition to information contained in the current picture.
The inter picture includes two picture types, i.e., a predicted picture (P picture), in which coding is performed using only information contained in a previous picture in reproduction order, and a bi-directional predicted picture (B picture), in which coding is performed additionally using information contained in a subsequent picture in reproduction order. In inter pictures, coding can be performed with block types adaptively switched on a block-by-block basis within each picture. The block types include an inter block, in which coding is performed using information contained in a reference picture, and an intra block, in which coding is performed using information contained in the current picture.
In inter pictures, coding can be performed using information contained in a reference picture, and, therefore, inter pictures are superior in data compression efficiency to I pictures.
On the other hand, in I pictures, coding is performed using only information contained in the current picture. Therefore, such random access processing can be performed that reproduction or editing and clipping of a moving image is started with not only the first picture but also an arbitrarily selected I picture.
Encoders generally perform coding while allocating the amount of code (code amount) to each picture depending on the above-mentioned picture types. Since, in an inter picture, coding is performed using a reference picture, improving the image quality of an I picture by allocating the more amount of code to the I picture enables also improving the image quality of a subsequent inter picture in which the I picture is used as a reference picture. With the image quality of the subsequent inter picture improved, the image quality of a further subsequent inter picture in which the former subsequent inter picture is used as a reference picture can be improved.
However, in the case of a moving image with a very quick movement, since a difference between a reference picture and a picture targeted for coding becomes large, improving the image quality of a subsequent picture by improving the image quality of an I picture has limited effectiveness. Nevertheless, if a very large amount of code is allocated to the I picture, since the amount of code to be allocated to a subsequent inter picture decreases, the image quality of the subsequent inter picture may be deteriorated.
Methods for solving the above-described issue include a method of calculating a picture complexity for each picture type and adaptively controlling the amount of code to be allocated to each picture according to the picture complexity (see Literature 3: U.S. Pat. No. 6,982,762). In the case of a video with little motion, since the complexity of an inter picture becomes relatively small as compared with that of an I picture, the large amount of code is allocated to the I picture.
However, the technique discussed in Literature 3 does not take into account the block types in each inter picture. Since the image quality of an inter block takes over from the image quality of a reference picture, the higher the image quality of the reference picture, the higher the image quality of the inter block becomes. On the other hand, an intra block, in which coding is performed using information contained in the current picture, does not take over from the image quality of a reference picture.
Therefore, although the effect of improving the image quality by allocating a large amount of code to an I picture is taken over to inter blocks in an inter picture, it is lost in intra blocks included in the inter picture, so that the image quality of the intra blocks may be deteriorated.
As the image quality of the intra blocks in the inter picture is deteriorated, the image quality of an inter picture in which the former inter picture with the image quality of intra blocks deteriorated is used as a reference picture may also be deteriorated.